﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace T01
{
    /// <summary>
    /// LoginWindow2.xaml 的交互逻辑
    /// </summary>
    public partial class LoginWindow2 : Window
    {
        public LoginWindow2()
        {
            InitializeComponent();
        }

        private void LoginBotton_Click(object sender, RoutedEventArgs e)
        {
            string username = TxtUsername.Text.Trim();
            string password = TxtPassWord.Password.Trim();
    

            if (UserDao.LoginCheck(username, password) > 0)
            {
                MessageBox.Show("登入成功");
                var mainWindow = new MainWindow();


                mainWindow.Title = "用户" + username + "登陆";
                
                mainWindow.Show();
                this.Close();
            }
            else {
                MessageBox.Show("用户名或密码错误!"); }


            }

        }
    }

